package com.dhh.vo;

public class Food {
	public final static String C_ROWID = "_id";
	public final static String C_FOOD_NAME = "food_name";
	public final static String C_FOOD_GROUP = "food_group";
	public final static String C_PROTEIN = "protein";
	public final static String C_FAT = "fat";
	public final static String C_CARB = "carb";
	
	public final static String FOOD_GROUP_GRAIN = "Grains";
	public final static String FOOD_GROUP_FRUIT = "Fruits";
	public final static String FOOD_GROUP_VEGETABLE = "Vegetables";
	public final static String FOOD_GROUP_DAIRY = "Dairy";
	public final static String FOOD_GROUP_PROTEIN = "Protein Food";
	
	private String id;
	private String foodName;
	private String foodGroup;
	private String protein;
	private String fat;
	private String carb;
	
	public Food(){}
	
	public Food(String id,String foodName,String foodGroup,String protein,String fat,String carb){
		this.id = id;
		this.foodName = foodName;
		this.foodGroup = foodGroup;
		this.protein = protein;
		this.fat = fat;
		this.carb = carb;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getFoodName() {
		return foodName;
	}
	public void setFoodName(String foodName) {
		this.foodName = foodName;
	}
	public String getFoodGroup() {
		return foodGroup;
	}
	public void setFoodGroup(String foodGroup) {
		this.foodGroup = foodGroup;
	}
	public String getProtein() {
		return protein;
	}
	public void setProtein(String protein) {
		this.protein = protein;
	}
	public String getFat() {
		return fat;
	}
	public void setFat(String fat) {
		this.fat = fat;
	}
	public String getCarb() {
		return carb;
	}
	public void setCarb(String carb) {
		this.carb = carb;
	}
	
	public String getEnergy(){
		if(protein!=null && fat!=null && carb!=null)
			return String.valueOf((Math.round(Double.parseDouble(protein)*4 + Double.parseDouble(fat)*9 + Double.parseDouble(carb)*4)));
		else
			return "0";
	}
	
	public String getUnit(){
		if(FOOD_GROUP_GRAIN.equals(foodGroup) || FOOD_GROUP_PROTEIN.equals(foodGroup))
			return "oz";
		return "cup";
	}
	
	public static String[] getColumns(){
		String[] columns = new String[]{C_ROWID,C_FOOD_NAME,C_FOOD_GROUP,C_PROTEIN,C_FAT,C_CARB};
		return columns;
	}
	
}
